package com.ssy.lingxi.member.merchant.controller.web;

import com.ssy.lingxi.common.response.PageData;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.member.merchant.model.vo.basic.request.MemberTypeIdVO;
import com.ssy.lingxi.member.merchant.model.vo.basic.request.RoleIdVO;
import com.ssy.lingxi.member.merchant.model.vo.basic.request.UpperMemberIdRoleIdVO;
import com.ssy.lingxi.member.merchant.model.vo.basic.response.MemberTypeIdAndNameVO;
import com.ssy.lingxi.member.merchant.model.vo.basic.response.UpperMemberShowVO;
import com.ssy.lingxi.member.merchant.model.vo.info.request.*;
import com.ssy.lingxi.member.merchant.model.vo.info.response.*;
import com.ssy.lingxi.member.merchant.model.vo.lifecycle.response.MemberAppraisalPageQueryVO;
import com.ssy.lingxi.member.merchant.model.vo.lifecycle.response.MemberCreditComplaintPageQueryVO;
import com.ssy.lingxi.member.merchant.model.vo.lifecycle.response.MemberRecordRectifyVO;
import com.ssy.lingxi.member.merchant.model.vo.maintenance.request.MemberDetailCreditHistoryPageVO;
import com.ssy.lingxi.member.merchant.model.vo.maintenance.response.*;
import com.ssy.lingxi.member.merchant.model.vo.validate.request.ValidateIdPageVO;
import com.ssy.lingxi.member.merchant.model.vo.validate.request.ValidateIdVO;
import com.ssy.lingxi.member.merchant.model.vo.validate.response.MemberValidateDetailLevelVO;
import com.ssy.lingxi.member.merchant.service.web.IMemberAbilityInfoService;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * @menu 会员能力 - 会员信息查询相关接口
 * @author 万宁
 * @version 2.0.0
 * @date 2020-09-07
 */
@RestController
@RequestMapping("/member/ability/info")
public class MemberAbilityInfoController {
    @Resource
    private IMemberAbilityInfoService memberAbilityInfoService;

    /**
     * 获取分页查询页面下拉框内容
     * @param headers Http头部信息
     * @return 下拉框内容
     */
    @RequestMapping(value = "/pageitems", method = RequestMethod.GET)
    public Wrapper<MemberInfoSearchConditionVO> getPageSearchConditions(@RequestHeader HttpHeaders headers) {
        return memberAbilityInfoService.getPageSearchConditions(headers);
    }

    /**
     * 分页、模糊查询归属会员列表
     * @param headers Http头部信息
     * @param pageVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/page", method = RequestMethod.GET)
    public Wrapper<PageData<UpperMemberInfoVO>> pageUpperMembers(@RequestHeader HttpHeaders headers, @Valid MemberInfoPageVO pageVO) {
        return memberAbilityInfoService.pageUpperMembers(headers, pageVO);
    }

    /**
     * “申请会员”页面，查询按钮状态和文本
     * @param headers Http头部信息
     * @param conditionVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/apply/condition", method = RequestMethod.GET)
    public Wrapper<MemberInfoApplyButtonVO> getApplyCondition(@RequestHeader HttpHeaders headers, @Valid MemberApplyConditionVO conditionVO) {
        return memberAbilityInfoService.getApplyCondition(headers, conditionVO);
    }

    /**
     * “邀请会员”页面，查询按钮状态和文本
     * @param headers Http头部信息
     * @param conditionVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/invite/condition", method = RequestMethod.GET)
    public Wrapper<MemberInfoInviteButtonVO> getInviteCondition(@RequestHeader HttpHeaders headers, @Valid MemberInviteConditionVO conditionVO) {
        return memberAbilityInfoService.getInviteCondition(headers, conditionVO);
    }

    /**
     * “申请会员”页面，会员注册资料信息
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/apply/detail", method = RequestMethod.GET)
    public Wrapper<MemberInfoApplyRegisterDetailVO> getApplyRegisterDetail(@RequestHeader HttpHeaders headers, @Valid UpperMemberIdRoleIdVO idVO) {
        return memberAbilityInfoService.getApplyRegisterDetail(headers, idVO);
    }

    /**
     * “申请会员”页面，会员入库资料信息
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/apply/deposit/detail", method = RequestMethod.GET)
    public Wrapper<MemberInfoApplyDepositDetailVO> getApplyDepositDetail(@RequestHeader HttpHeaders headers, @Valid UpperMemberIdRoleIdVO idVO) {
        return memberAbilityInfoService.getApplyDepositDetail(headers, idVO);
    }

    /**
     * “申请会员” - 提交
     * @param headers Http头部信息
     * @param subVO 接口参数
     * @return 申请结果
     */
    @RequestMapping(value = "/apply", method = RequestMethod.POST)
    public Wrapper<Void> applyToBeSubMember(@RequestHeader HttpHeaders headers, @RequestBody @Valid MemberInfoApplyForSubVO subVO) {
        return memberAbilityInfoService.applyToBeSubMember(headers, subVO);
    }

    /**
     * 获取“修改注册信息”页面，会员注册资料信息
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/detail", method = RequestMethod.GET)
    public Wrapper<MemberInfoUpdateDetailVO> getMemberRegisterDetail(@RequestHeader HttpHeaders headers, @Valid ValidateIdVO idVO) {
        return memberAbilityInfoService.getMemberRegisterDetail(headers, idVO);
    }

    /**
     * 修改注册信息
     * @param headers Http头部信息
     * @param detailVO 接口参数
     * @return 修改结果
     */
    @RequestMapping(value = "/detail/update", method = RequestMethod.POST)
    public Wrapper<Void> updateMemberRegisterDetail(@RequestHeader HttpHeaders headers, @RequestBody @Valid MemberInfoUpdateRegisterDetailVO detailVO) {
        return memberAbilityInfoService.updateMemberRegisterDetail(headers, detailVO);
    }

    /**
     * 获取“修改入库信息”页面，会员入库资料信息
     * @param headers Http头部信息
     * @param idVO 会员关系Id
     * @return 查询结果
     */
    @RequestMapping(value = "/deposit/detail", method = RequestMethod.GET)
    public Wrapper<MemberInfoUpdateDepositDetailQueryVO> getMemberDepositDetail(@RequestHeader HttpHeaders headers, @Valid ValidateIdVO idVO) {
        return memberAbilityInfoService.getMemberDepositDetail(headers, idVO);
    }

    /**
     * 修改会员入库信息
     * @param headers Http头部信息
     * @param detailVO 接口参数
     * @return 修改结果
     */
    @RequestMapping(value = "/deposit/detail/update", method = RequestMethod.POST)
    public Wrapper<Void> updateMemberDepositDetail(@RequestHeader HttpHeaders headers, @RequestBody @Valid MemberInfoUpdateDepositDetailVO detailVO) {
        return memberAbilityInfoService.updateMemberDepositDetail(headers, detailVO);
    }

    /**
     * 会员详情 - 会员基本信息
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/detail/basic", method = RequestMethod.GET)
    public Wrapper<MemberInfoBasicDetailVO> getMemberBasicDetail(@RequestHeader HttpHeaders headers, @Valid ValidateIdVO idVO) {
        return memberAbilityInfoService.getMemberBasicDetail(headers, idVO);
    }

    /**
     * 会员详情 - 会员档案信息
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/detail/archives", method = RequestMethod.GET)
    public Wrapper<MemberInfoDepositDetailVO> getMemberArchives(@RequestHeader HttpHeaders headers, @Valid ValidateIdVO idVO) {
        return memberAbilityInfoService.getMemberArchives(headers, idVO);
    }

    /**
     * 会员详情- 会员档案 - 分页查询考评信息
     * @param headers HttpHeader信息
     * @param pageVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/detail/appraisal/page", method = RequestMethod.GET)
    public Wrapper<PageData<MemberAppraisalPageQueryVO>> pageMemberAppraisal(@RequestHeader HttpHeaders headers, @Valid ValidateIdPageVO pageVO) {
        return memberAbilityInfoService.pageMemberAppraisal(headers, pageVO);
    }

    /**
     * 会员详情 - 会员档案 - 分页查询会员整改
     * @param headers Http头部信息
     * @param pageVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/detail/rectify/page", method = RequestMethod.GET)
    public Wrapper<PageData<MemberRecordRectifyVO>> pageMemberRecordRectify(@RequestHeader HttpHeaders headers, @Valid ValidateIdPageVO pageVO) {
        return memberAbilityInfoService.pageMemberRecordRectify(headers, pageVO);
    }

    /**
     * 会员详情 - 会员等级信息
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/detail/level/basic", method = RequestMethod.GET)
    public Wrapper<MemberValidateDetailLevelVO> getMemberLevelDetail(@RequestHeader HttpHeaders headers, @Valid ValidateIdVO idVO) {
        return memberAbilityInfoService.getMemberDetailLevel(headers, idVO);
    }

    /**
     * 会员详情 - 会员等级信息 - 分页查询交易分获取记录
     * @param headers Http头部信息
     * @param pageVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/detail/level/history/page", method = RequestMethod.GET)
    public Wrapper<PageData<MemberDetailLevelHistoryVO>> pageMemberLevelDetailHistory(@RequestHeader HttpHeaders headers, @Valid ValidateIdPageVO pageVO) {
        return memberAbilityInfoService.pageMemberLevelDetailHistory(headers, pageVO);
    }

    /**
     * 会员详情 - 会员权益信息
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/detail/right/basic", method = RequestMethod.GET)
    public Wrapper<MemberDetailRightVO> getMemberDetailRight(@RequestHeader HttpHeaders headers, @Valid ValidateIdVO idVO) {
        return memberAbilityInfoService.getMemberDetailRight(headers, idVO);
    }

    /**
     * 会员详情 - 会员权益信息 - 分页查询会员权益获取记录
     * @param headers Http头部信息
     * @param pageVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/detail/right/history/page", method = RequestMethod.GET)
    public Wrapper<PageData<MemberDetailRightHistoryVO>> pageMemberDetailRightHistory(@RequestHeader HttpHeaders headers, @Valid ValidateIdPageVO pageVO) {
        return memberAbilityInfoService.pageMemberDetailRightHistory(headers, pageVO);
    }

    /**
     * 会员详情 - 会员权益信息 - 分页查询会员权益使用记录
     * @param headers Http头部信息
     * @param pageVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/detail/right/spend/history/page", method = RequestMethod.GET)
    public Wrapper<PageData<MemberDetailRightSpendHistoryVO>> pageMemberDetailRightSpendHistory(@RequestHeader HttpHeaders headers, @Valid ValidateIdPageVO pageVO) {
        return memberAbilityInfoService.pageMemberDetailRightSpendHistory(headers, pageVO);
    }

    /**
     * 会员详情 - 会员信用信息
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/detail/credit/basic", method = RequestMethod.GET)
    public Wrapper<MemberDetailCreditVO> getMemberDetailCredit(@RequestHeader HttpHeaders headers, @Valid ValidateIdVO idVO) {
        return memberAbilityInfoService.getMemberDetailCredit(headers, idVO);
    }

    /**
     * 会员详情 - 会员信用信息 - 交易评价汇总
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/detail/credit/trade/summary", method = RequestMethod.GET)
    public Wrapper<MemberDetailCreditCommentSummaryVO> getMemberDetailCreditTradeCommentSummary(@RequestHeader HttpHeaders headers, @Valid ValidateIdVO idVO) {
        return memberAbilityInfoService.getMemberDetailCreditTradeCommentSummary(headers, idVO);
    }

    /**
     * 会员详情 - 会员信用 - 分页查询交易评论历史记录
     * @param headers Http头部信息
     * @param pageVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/detail/credit/trade/history/page", method = RequestMethod.GET)
    public Wrapper<PageData<MemberDetailCreditTradeHistoryVO>> pageMemberDetailCreditTradeCommentHistory(@RequestHeader HttpHeaders headers, MemberDetailCreditHistoryPageVO pageVO) {
        return memberAbilityInfoService.pageMemberDetailCreditTradeCommentHistory(headers, pageVO);
    }

    /**
     * 会员详情 - 会员信用信息 - 售后评价汇总
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/detail/credit/aftersale/summary", method = RequestMethod.GET)
    public Wrapper<MemberDetailCreditCommentSummaryVO> getMemberDetailCreditAfterSaleCommentSummary(@RequestHeader HttpHeaders headers, @Valid ValidateIdVO idVO) {
        return memberAbilityInfoService.getMemberDetailCreditAfterSaleCommentSummary(headers, idVO);
    }

    /**
     * 会员详情 - 会员信用 - 分页查询售后评论历史记录
     * @param headers Http头部信息
     * @param pageVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/detail/credit/aftersale/history/page", method = RequestMethod.GET)
    public Wrapper<PageData<MemberDetailCreditAfterSaleHistoryVO>> pageMemberDetailCreditAfterSaleCommentHistory(@RequestHeader HttpHeaders headers, @Valid MemberDetailCreditHistoryPageVO pageVO) {
        return memberAbilityInfoService.pageMemberDetailCreditAfterSaleCommentHistory(headers, pageVO);
    }

    /**
     * 会员详情 - 会员信用 - 投诉汇总
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/detail/credit/complain/summary", method = RequestMethod.GET)
    public Wrapper<MemberDetailCreditComplainSummaryVO> getMemberDetailCreditComplainSummary(@RequestHeader HttpHeaders headers, @Valid ValidateIdVO idVO) {
        return memberAbilityInfoService.getMemberDetailCreditComplainSummary(headers, idVO);
    }

    /**
     * 会员详情 - 会员信用 - 分页查询投诉历史记录
     * @param headers Http头部信息
     * @param pageVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/detail/credit/complain/history/page", method = RequestMethod.GET)
    public Wrapper<PageData<MemberCreditComplaintPageQueryVO>> pageMemberDetailCreditComplainHistory(@RequestHeader HttpHeaders headers, @Valid ValidateIdPageVO pageVO) {
        return memberAbilityInfoService.pageMemberDetailCreditComplainHistory(headers, pageVO);
    }

    /**
     * “增加会员角色”功能，查询上级会员列表
     * @param headers Http头部信息
     * @return 查询结果
     */
    @RequestMapping(value = "/upperMemberInfo", method = RequestMethod.GET)
    public Wrapper<UpperMemberShowVO> getUpperMemberInfo(@RequestHeader HttpHeaders headers){
        return memberAbilityInfoService.getUpperMemberInfo(headers);
    }

    /**
     * “增加会员角色”功能，查询会员类型列表
     * @param headers Http头部信息
     * @param memberId 会员id
     * @return 查询结果
     */
    @RequestMapping(value = "/membertype/list", method = RequestMethod.GET)
    public Wrapper<List<MemberTypeIdAndNameVO>> getMemberTypeList(@RequestHeader HttpHeaders headers, Long memberId) {
        return memberAbilityInfoService.getMemberTypeList(headers, memberId);
    }

    /**
     * “增加会员角色”功能，根据会员类型Id查询角色列表
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/role/list", method = RequestMethod.GET)
    public Wrapper<MemberInfoRoleListVO> getRoleListByMemberType(@RequestHeader HttpHeaders headers, @Valid MemberTypeIdVO idVO) {
        return memberAbilityInfoService.getRoleListByMemberType(headers, idVO);
    }

    /**
     * “增加会员角色”功能，获取员注册资料信息
     * @param headers Http头部信息
     * @param roleIdVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/detail/byrole", method = RequestMethod.GET)
    public Wrapper<MemberInfoUpdateDetailByRoleVO> getMemberRegisterDetailAfterAddRole(@RequestHeader HttpHeaders headers, @Valid RoleIdVO roleIdVO) {
        return memberAbilityInfoService.getMemberRegisterDetailAfterAddRole(headers, roleIdVO);
    }

    /**
     * “增加会员角色”功能，提交注册资料并新增角色
     * @param headers Http头部信息
     * @param addRoleVO 接口参数
     * @return 新增结果
     */
    @RequestMapping("/addrole")
    public Wrapper<Void> addMemberRole(@RequestHeader HttpHeaders headers, @RequestBody @Valid MemberInfoAddRoleVO addRoleVO) {
        return memberAbilityInfoService.addMemberRole(headers, addRoleVO);
    }
}
